package com.zkthink.ceres.product.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.zkthink.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.zkthink.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 商品分类表
 * </p>
 *
 * @author JustArgo
 * @since 2020-05-19
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_product_category")
@ApiModel(value = "ProductCategory", description = "商品分类表")
@AllArgsConstructor
public class ProductCategory extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 类目简称
     */
    @ApiModelProperty(value = "类目简称")
    @Length(max = 10, message = "类目简称长度不能超过10")
    @TableField(value = "short_name", condition = LIKE)
    @Excel(name = "类目简称")
    private String shortName;

    /**
     * 类目名称
     */
    @ApiModelProperty(value = "类目名称")
    @Length(max = 30, message = "类目名称长度不能超过30")
    @TableField(value = "category_name", condition = LIKE)
    @Excel(name = "类目名称")
    private String categoryName;

    /**
     * 类目关联页面路径
     */
    @ApiModelProperty(value = "类目关联页面路径")
    @Length(max = 250, message = "类目关联页面路径长度不能超过250")
    @TableField(value = "category_path", condition = LIKE)
    @Excel(name = "类目关联页面路径")
    private String categoryPath;

    /**
     * 分类图片，目前只有3级类目才有图片
     */
    @ApiModelProperty(value = "分类图片，目前只有3级类目才有图片")
    @Length(max = 255, message = "分类图片，目前只有3级类目才有图片长度不能超过255")
    @TableField(value = "category_img", condition = LIKE)
    @Excel(name = "分类图片，目前只有3级类目才有图片")
    private String categoryImg;

    /**
     * 层级
     */
    @ApiModelProperty(value = "层级")
    @TableField("depth")
    @Excel(name = "层级")
    private Integer depth;

    /**
     * 父类名称
     */
    @ApiModelProperty(value = "父类名称")
    @Length(max = 30, message = "父类名称长度不能超过30")
    @TableField(value = "parent_name", condition = LIKE)
    @Excel(name = "父类名称")
    private String parentName;

    /**
     * 父类id
     */
    @ApiModelProperty(value = "父类id")
    @TableField("parent_id")
    @Excel(name = "父类id")
    private Long parentId;

    /**
     * 排序值
     */
    @ApiModelProperty(value = "排序值")
    @TableField("sort_order")
    @Excel(name = "排序值")
    private Integer sortOrder;

    /**
     * 状态：1-启用 0-删除
     */
    @ApiModelProperty(value = "状态：1-启用 0-删除")
    @TableField("status")
    @Excel(name = "状态：1-启用 0-删除")
    private Integer status;

    /**
     * 逻辑删除 1-删除 0-未删除
     */
    @ApiModelProperty(value = "逻辑删除 1-删除 0-未删除")
    @NotNull(message = "逻辑删除 1-删除 0-未删除不能为空")
    @TableField("is_delete")
    @Excel(name = "逻辑删除 1-删除 0-未删除")
    private Integer isDelete;


    @Builder
    public ProductCategory(Long id, Long createUser, LocalDateTime createTime, Long updateUser, LocalDateTime updateTime, 
                    String shortName, String categoryName, String categoryPath, String categoryImg, Integer depth, 
                    String parentName, Long parentId, Integer sortOrder, Integer status, Integer isDelete) {
        this.id = id;
        this.createUser = createUser;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateTime = updateTime;
        this.shortName = shortName;
        this.categoryName = categoryName;
        this.categoryPath = categoryPath;
        this.categoryImg = categoryImg;
        this.depth = depth;
        this.parentName = parentName;
        this.parentId = parentId;
        this.sortOrder = sortOrder;
        this.status = status;
        this.isDelete = isDelete;
    }

}
